package com.my.db.test.jpa;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author timo 2021/3/4
 */
@RestController
@RequestMapping("jpatest")
@Slf4j
public class EmployeeJpaController {

    @Autowired
    private EmployeeJpaService employeeJpaService;

    @GetMapping("/list")
    public List<EmployeeJpa> findAll(){
//        log.info();
        return employeeJpaService.findAll();
    }
    @RequestMapping("/save")
    public Boolean save(@RequestBody EmployeeJpa employee){
        employeeJpaService.save(employee);
        return Boolean.TRUE;
    }
//    @RequestMapping("/update")
//    public Boolean update(@RequestBody EmployeeJpa employee){
//        employeeRepository.save(employee);
//        return Boolean.TRUE;
//    }
//    @RequestMapping("/delete{id}")
//    public Boolean update(@PathVariable long id){
//        employeeRepository.deleteById(id);
//        return Boolean.TRUE;
//    }


}
